# -*- mode: python; -*-
#
#Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

Import('DnsEnv')
import platform

env = DnsEnv.Clone()
env.CppDisableExceptions()

env.Append(CPPPATH = env['TOP'])
env.Append(LIBPATH = ['#/' + Dir('..').path,
                      '../../db',
                      '../../ifmap',
                      '../../net',
                      '../../schema',
                      '../../xml',
                      '.'
                     ])

env.Append(LIBPATH = env['TOP'] + '/schema')
env.Append(LIBPATH = env['TOP'] + '/base/test')
env.Append(LIBPATH = env['TOP'] + '/db/test')
env.Append(LIBPATH = env['TOP'] + '/ifmap/test')

env.Prepend(LIBS = ['dbtest', 'ifmap_vnc', 'task_test',
                    'pugixml', 'curl', 'net',
                    'ifmap_test_util', 'ifmap_test_util_server',
                    'ifmap_server', 'ifmap_common',
                    'ifmapio', 'crypto', 'ssl', 'process_info',
                    'db', 'sandeshvns', 'io', 'base', 'xml',
                    'boost_regex', 'boost_program_options', 'gunit'])

env.Prepend(LIBS=['dns_cfg', 'cmn', 'mgr', 'agent_xmpp', 'bind_interface'])
env.Append(LIBS=['sandesh', 'http', 'http_parser'])

if platform.system() not in ['Windows', 'Darwin']:
    env.Prepend(LINKFLAGS =
                ['-Wl,--whole-archive',
                 '-rdynamic',
                 '-Wl,--no-whole-archive'])

dns_config_test = env.UnitTest('dns_config_test', ['dns_config_test.cc'])
env.Alias('src/dns:dns_config_test', dns_config_test)

dns_bind_test = env.UnitTest('dns_bind_test', ['dns_bind_test.cc'])
env.Alias('src/dns:dns_bind_test', dns_bind_test)

dns_options_test = env.UnitTest('dns_options_test', ['dns_options_test.cc'])
env.Alias('src/dns:dns_options_test', dns_options_test)

dns_mgr_test = env.UnitTest('dns_mgr_test', ['dns_mgr_test.cc'])
env.Alias('src/dns:dns_mgr_test', dns_mgr_test)

test_suite = [
                dns_bind_test,
                dns_options_test,
             ]

test = env.TestSuite('dns-test', test_suite)
env.Alias('controller/src/dns:test', test)
env.Alias('controller/src/dns:flaky-test', [
    dns_config_test,
    dns_mgr_test,
])
Return('test_suite')

